Page({
	data: { 
	  tabbars:{
			list: [
			{
				pagePath: "/pages/home/home",
				text: "首页",
				icon:"wap-home-o",
			},
			{
				pagePath: "/pages/category/category",
				text: "分类",
				icon:"apps-o",
			},
			{
				pagePath: "/pages/cart/cart",
				text: "购物车",
				icon:"shopping-cart-o",
			},
			{
			pagePath: "/pages/user/user",
			text: "我的",
			icon:"user-circle-o",
			}
			],
			active: 0,
		}
	},
	
	onChange: function(event) {
		// event.detail 的值为当前选中项的索引
		console.log(event.detail);
		const index = event.detail;
		// 活跃tabbar子项设置
		this.setData({
			"tabbars.active": index
		});
		// 页面路由
		wx.switchTab({
			url: this.data.tabbars.list[index].pagePath
		});
	},
})